/*
 * Created: 2022-08-25 19:23:03
 * Author : 涛涛涛
 */

import React, { useContext } from 'react';
import { View, Text } from '@tarojs/components';
import { styled } from 'linaria/react';
import { useClassName } from '@/utils/index';
import { ProductItemContext } from '@/pages/Home/ProductList/ProductItem/ProductItemContext';

export interface IProps extends ICompProps {}
Description.defaultProps = {} as Partial<IProps>;
function Description(props: IProps) {
    const { className, style } = props;
    const localClassName = useClassName('Description', className);
    const {
        artwork: { name: artworkName },
        author: { name: authorName },
    } = useContext(ProductItemContext);
    return (
        <RootView className={localClassName} style={style}>
            <View className="product-name">{artworkName}</View>
            <View className="auther-name">
                <Text>创作者</Text>
                <Text className="colon">:</Text>
                <Text>{authorName}</Text>
            </View>
        </RootView>
    );
}
export default React.memo(Description);
const RootView = styled(View)`
    &.Description {
        margin-left: 50px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        .product-name {
            font-size: 32px;
            line-height: 1;
            font-weight: 600;
            color: #000;
        }
        .auther-name {
            margin-top: 20px;
            font-size: 24px;
            /* font-weight: 600; */
            line-height: 1;
            color: #999;
            .colon {
                margin: 0 4px;
            }
        }
    }
`;
